/**
 *发布配置
 */
var mongoose  = require('mongoose');
var BaseModel = require("./base_model");
var Schema    = mongoose.Schema;

var PublishConfigSchema = new Schema({
    product_configs:[{type:Schema.Types.ObjectId, ref:'ProductConfig'}],
    type:{
        type: String, //mk|app
        required: true
    },
    name:{             //商品名，要求store内唯一
        type:String,
        require: true
    },
    project:{          //关联项目，做查询用，冗余
        type: Schema.Types.ObjectId,
        ref: 'Project',
        require: true
    },
    extend_info:{
        type: Schema.Types.Mixed  //扩展字段，存放其他信息，如：商品简介、商品标签等其他信息
    },
    create_at: {
        type: Date, default: Date.now
    },
    update_at: {
        type: Date, default: Date.now
    }
});

PublishConfigSchema.plugin(BaseModel);
mongoose.model('PublishConfig', PublishConfigSchema);
